﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RexToy.Cassandra
{
    public static class MarshalUtil
    {
        public static void AdjustBufferOrder(byte[] bytes, int start, int end)
        {
            Assertion.IsTrue(start < end, "start must less than end.");
            byte swap;
            for (int i = start, j = end; i < (start + end + 1) / 2; i++, j--)
            {
                swap = bytes[i];
                bytes[i] = bytes[j];
                bytes[j] = swap;
            }
        }

        public static void AdjustBufferOrder(byte[] bytes)
        {
            byte swap;
            for (int i = 0, j = bytes.Length - 1; i < bytes.Length / 2; i++, j--)
            {
                swap = bytes[i];
                bytes[i] = bytes[j];
                bytes[j] = swap;
            }
        }
    }
}
